Skip to content

fix: agent manager terminal follows context when switching to local mode#6360

Merged
marius-kilocode merged 5 commits intomainfrom
fix/agent-manager-local-terminal
Feb 26, 2026
Merged

fix: agent manager terminal follows context when switching to local mode#6360
marius-kilocode merged 5 commits intomainfrom
fix/agent-manager-local-terminal

Conversation

@marius-kilocode
Copy link
Collaborator

Summary

  • When switching from a worktree to local mode with a pending (new session) tab, currentSessionID() was undefined, causing the terminal keyboard shortcut (Cmd+/) and button click to silently do nothing.
  • Added showLocalTerminal message/handler that opens a terminal at workspace root when triggered in local mode without an active session.
  • Added showExistingLocalTerminal message/handler to auto-reveal the local terminal when switching contexts (mirrors the existing showExisting behavior for worktree sessions).

Changes

File Change
SessionTerminalManager.ts Added showLocalTerminal() method using __local__ key
AgentManagerProvider.ts Handle showLocalTerminal and showExistingLocalTerminal messages
AgentManagerApp.tsx Terminal triggers fall back to local terminal; selectLocal() sends showExistingLocalTerminal for pending tabs
messages.ts Added ShowLocalTerminalRequest and ShowExistingLocalTerminalRequest types
agent-manager-arch.test.ts Updated expected message handler list

@kilo-code-bot
Copy link
Contributor

kilo-code-bot bot commented Feb 25, 2026

Code Review Summary

Status: No Issues Found | Recommendation: Merge

Files Reviewed (5 files)
  • packages/kilo-vscode/src/agent-manager/AgentManagerProvider.ts
  • packages/kilo-vscode/src/agent-manager/SessionTerminalManager.ts
  • packages/kilo-vscode/tests/unit/agent-manager-arch.test.ts
  • packages/kilo-vscode/webview-ui/agent-manager/AgentManagerApp.tsx
  • packages/kilo-vscode/webview-ui/src/types/messages.ts

@marius-kilocode marius-kilocode force-pushed the fix/agent-manager-local-terminal branch from 4a43124 to 20e3187 Compare February 26, 2026 09:25
@marius-kilocode marius-kilocode requested a review from a team February 26, 2026 10:05
When switching from a worktree to local mode with a pending tab,
currentSessionID() was undefined causing terminal triggers (Cmd+/ and
button click) to silently do nothing. Added a showLocalTerminal fallback
that opens a terminal at workspace root, and showExistingLocalTerminal
to auto-reveal the local terminal when switching contexts.
@marius-kilocode marius-kilocode force-pushed the fix/agent-manager-local-terminal branch from 20e3187 to a8431cb Compare February 26, 2026 10:09
return null
}
if (type === "agentManager.showExistingLocalTerminal") {
this.terminalManager.showExisting("__local__")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WARNING: Duplicated reserved terminal key may drift

This hardcoded "__local__" key is duplicated across multiple files. If one side changes, showExistingLocalTerminal silently becomes a no-op because the map lookup misses. Consider centralizing the local terminal key in one shared constant (or adding a dedicated showExistingLocalTerminal() method on the terminal manager) to prevent future regressions.

@marius-kilocode marius-kilocode enabled auto-merge (squash) February 26, 2026 12:36
@marius-kilocode marius-kilocode merged commit dab4ae7 into main Feb 26, 2026
11 checks passed
@marius-kilocode marius-kilocode deleted the fix/agent-manager-local-terminal branch February 26, 2026 13:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants